/**
 * Copyright (c) 2010-2011 julewa.com.  
 * All rights reserved. 
 * 
 * @author Huang Benhua
 * @date 2011-6-18
 * 
**/
package com.julewa.utils;

import com.julewa.db.checkers.PatternMatcher;

public class Patterns {
	
	public static final PatternMatcher DOMAIN = 
		new PatternMatcher("([\\w-]+\\.)+[a-zA-Z]{2,4}");
	
	public static final PatternMatcher EMAIL = 
		new PatternMatcher("\\w+([-+.]\\w+)*@" + DOMAIN); 

	public static final PatternMatcher CHINESE_WORD = 
		new PatternMatcher("[\\u4e00-\\u9fa5]"); 
	
	public static final PatternMatcher DOUBLE_WORD = 
		new PatternMatcher("[^\\x00-\\xff]"); 
	
	public static final PatternMatcher BLANK_LINE = 
		new PatternMatcher("\\n\\s*\\r"); 
	
	public static final PatternMatcher IP =
		new PatternMatcher("\\d+\\.\\d+\\.\\d+\\.\\d+");

	public static final PatternMatcher PHONE = 
		new PatternMatcher("\\d{3}-\\d{8}|\\d{4}-\\d{7}");

	public static final PatternMatcher QQ = 
		new PatternMatcher("[1-9][0-9]{4,}"); 

	public static final PatternMatcher MOBILE = 
		new PatternMatcher("[1-9][0-9]{10,}"); 

	public static final PatternMatcher ACCOUNT_ENG = 
		new PatternMatcher("^[a-zA-Z][a-zA-Z0-9_]{4,15}$");

	public static final PatternMatcher POSTCODE = 
		new PatternMatcher("[1-9]\\d{5}");
	
	public static final PatternMatcher IDENTIFIER = 
		new PatternMatcher("\\d{14}|\\d{17}(\\d|[xX])?");
	
	///////////////
	public static final PatternMatcher INTEGER = 
		new PatternMatcher("[1-9]\\d*"); 
	
	public static final PatternMatcher NUMBER = 
		new PatternMatcher("[1-9]\\d*\\.?\\d* |0\\.?\\d*[1-9]\\d*"); 
	
	public static final PatternMatcher XMLTAGS = 
		new PatternMatcher("<[^<,^>]+>[^<,^>]+</[^<,^>]+>");
}
